package com.mmr.util;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

import java.lang.reflect.Type;
import java.util.Map;

public class ToolUtil {

    public static MultiValueMap<String, String> jsonToMultiMap(String dataJsonStr) {
        MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<String, String>();
        Map<String, String> paramMap = JSONObject.parseObject(dataJsonStr, (Type) Map.class);
        for (Map.Entry<String, String> entry : paramMap.entrySet()) {
            multiValueMap.add(entry.getKey(), entry.getValue());
        }
        return multiValueMap;
    }
}
